#Include "protheus.ch"

User Function SetObr(cCampo, lLigaObr, lAcols)
**************************************
 
Local nPos
Local cTitulo := RetTitle(cCampo)
 
Private oDlg  := GetWndDefault()
 
Default lLigaObr  := .T.
 
If Type("aGets") != "U"
	    
     nPos := aScan(aGets, {|x| AllTrim(SubStr(x,9,10)) == AllTrim(cCampo)})
	    
     If nPos > 0
          If lLigaObr
                aGets[nPos] := SubStr(aGets[nPos],1,24) + "T" + SubStr(aGets[nPos],26)
          Else
                aGets[nPos] := SubStr(aGets[nPos],1,24) + "F" + SubStr(aGets[nPos],26)
          End
	         
          If Type("oDlg") == "O"
	               
                nPos := aScan(oDlg:aControls, {|x| x:cCaption == cTitulo})
	               
                If nPos > 0
                     If lLigaObr
                          oDlg:aControls[nPos]:nClrText := 16580608
                     Else
                          oDlg:aControls[nPos]:nClrText := 0
                     End
                End
	               
                oDlg:Refresh()
          End
     End
End
 
Return